{include('Layout/header')}

<script charset="utf-8" src="{$host}statics/editor/kindeditor.js"></script>
<script charset="utf-8" src="{$host}statics/editor/lang/zh_CN.js"></script>
<script>
    KindEditor.ready(function(K) {
        window.editor = K.create('#editor_id', {
            width : '100%',
            height: '450px',
            uploadJson : "{\Rexzy::url('admin/artupload')}",
            filterMode: true,
        });
    });
</script>



<div class="row row-bgcolor">
    <div class='col-md-12 content-title'>
        <h3>编辑文章</h3>
    </div>
    <div class='col-md-12 content col-md-offset-1'>
        <form>
            <div class="col-md-8 form-group">
                <input type="text" class="form-control art-title" id="art_title" name="arttitle" placeholder='标题' value="{$artMesg['title']}"/>
                <div>
                    <label for="outline">文章概要</label>
                    <textarea class="form-control" rows="5" id="outline" name="ourline">{$artMesg['outline']}</textarea>
                    <p class="outline-note">文章概要用于在博客主页显示每篇文章的简介</p>
                </div>
                <textarea id="editor_id" name="content" style="width:100%;height:300px;">{$artMesg['content']}
                
                </textarea>
                <button type="submit" class="btn btn-info issueart" id='addart-btn'>编辑文章</button>
                <a href="{$artlistUrl}" class="return-artlist-btn">返回文章列表</a>
            </div>
            <div class='col-md-2 artwrite-options'>
                <ul class='main-option'>
                    <li><a href='#' class='main-option-choice'>选项</a></li>
                    <!--<li><a href='#' class='main-option-choice'>附件</a></li>-->
                </ul>
                <div class='artwrite-act-content'>
                    <div class="form-group">
                        <label for="issuetime">发布日期</label>
                        <input type="text" class="form-control datepicker" id="issue_time" name="issuetime" data-date-format="yyyy-mm-dd" size="16" value="{$artMesg['date']}"/>
                        <input type='text' name='artid' id='artid' value="{$artMesg['artid']}" style='display:none;'/>
                    </div>  
                    <div>
                        <label for="time">分类</label>
                        <ul class='artsort-choice'>
                            {php} 
                                function sortChoice( $id, $artsort ) {
                                    $sorts = $artsort->selectAll( 'sortid, name, parent, children', "where parent = $id" );
                                    foreach ( $sorts as $key => $value ) {
                                    echo "<li><label class='checkbox-inline'><input class='artwrite-sortchoice-box' type='checkbox' value='" . $value['sortid'] . "'>" . $value['name'] . "</label></li>";
                                        if ( $value['children'] > 0 ) {
                                            sortChoice( $value['sortid'], $artsort );
                                        }
                                    }
                                }
                                sortChoice( 0, $artsort );
                            {/php}
                        </ul>
                    </div>
<!--                    <div class="form-group">
                        <label for="art-tag">标签</label>
                        <input type="text" class="form-control" id="art_tag" name="arttag" />
                    </div>-->
                </div>
<!--                <div class='artwrite-act-content'>
                    这里是附件操作
                </div>-->
            </div>
        </form>
    </div>
<!--</div>-->

<script>
    artissue( '#addart-btn', '{$handleUrl}' ); 
    
    $(function() {
       var sort = '{$artMesg['sort']}';
       var sorts = sort.split(',');
       $(".artwrite-sortchoice-box").each( function() {
           if ( $.inArray( $(this).val(), sorts ) != -1 ) {
               this.checked = true;
           }
       });
    });
</script>




<!--<script>
    $(function() {
        $(".main-option-choice").each( function( i ) {
            $(this).click( function() {
                $('.artwrite-act-content').hide().eq( i ).show();
            });
        }).eq(0).click();
    });
</script>-->
{include('Layout/footer')}